package com.sporadic.desk.controller;

import com.sporadic.desk.service.UserService;
import dto.UserDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import vo.ResponseData;

import java.util.List;

/**
 * @program: sporadic
 * @description:
 * @author: LHD   QQ:1727865856
 * @create: 2019-11-26 11:55
 **/
@RestController
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/selAllUser")
    public ResponseData<List<UserDTO>> selAllUser(@RequestParam(required = false, value = "phone") String phone) {
        List<UserDTO> userDTOList = userService.selAll(phone);
        return userDTOList.isEmpty() ? new ResponseData<List<UserDTO>>(null, "不存在此用户") : new ResponseData<>(userDTOList);
    }
}
